package demo1;

import java.sql.SQLOutput;

public class OuterClass {
    public int data1=1;
    private int data2=2;
    public static int data3=3;

    //静态内部类
    static class InnerClass{
        public int data4;

        public void test(){
            OuterClass outerClass = new OuterClass();
            System.out.println("inner::test()");
            //内部类访问外部类非静态变量需要借助外部类对象
            System.out.println(outerClass.data1);
            System.out.println(outerClass.data2);
            //可直接访问外部类静态变量
            System.out.println(data3);
            System.out.println(data4);
        }
    }
}
